<%@ page import="java.util.jar.Attributes.Name"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="support.*, java.util.*" %>
    
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Address</title>
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>

<%
	// Get citizenship from HTTP request
	String country = request.getParameter("residence");
	String countryID = request.getParameter("residenceID");
	
	// Store citizenship in session
	Map residence = new HashMap();
	residence.put("id", countryID);
	residence.put("country", country);
	session.setAttribute("residence", residence);
	
	// 
	Map name = (Map) session.getAttribute("name");
	Map citizen = (Map) session.getAttribute("citizen");
%>

<h1>Your information</h1>
Name: <%= name.get("first_name") + " " + name.get("last_name") + " " + name.get("middle_name") %> <br />
Citizenship: <%= citizen.get("country") %> <br />
Residence: <%= residence.get("country") %>
<hr>

<h1>Please enter your address</h1>
<form name="form1" action="degree_location.jsp" method="post">
Street:<input type="text" name="street"><br />
City:<input type="text" name="city"><br />
<% 
if (Integer.parseInt((String)residence.get("id")) == 212){ 
	out.println("State:<input type=\"text\" name=\"state\"><br />");
}
%>
Zipcode:<input type="text" name="zipcode"><br />
Phone number:
<% 
if (Integer.parseInt((String)residence.get("id")) != 212){ 
	out.println("+<input type=\"text\" name=\"countrycode\" size=3>");
}
%>
<input type="text" name="areacode" size=4><input type="text" name="phone" size=10><br />
<input type="submit" value="Submit">
</form>
</body>
</html>